Use fuses to simplify or replace the ForOfPIC code
Categories
(Core :: JavaScript Engine, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox137 | --- | fixed |
People
(Reporter: jandem, Assigned: jandem)
References
(Blocks 2 open bugs)
Details
Attachments
(11 files)
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
Assignee | ||
Comment 1•3 months ago
|
||
This makes fuses a little more robust when code messes with prototypes without
actually changing the property's value.
Assignee | ||
Comment 2•3 months ago
|
||
The callers have it available so there's no need to look it up again.
Assignee | ||
Comment 3•3 months ago
|
||
Renames PropertyChange
to PropertyFlagsChange
because this operation now only
covers the property flags. This is now only called when we're actually changing the
flags.
Adds separate watchPropertyModification
calls for the case where defineProperty
is used to change the property's value (or both the value and the flags).
These changes help avoid unnecessary Watchtower calls.
Assignee | ||
Comment 4•3 months ago
|
||
This fixes a pre-exsting bug: the iterator must be created in the realm of the
arguments object.
Assignee | ||
Comment 5•3 months ago
|
||
OptimizeGetIteratorFuse
guards against:
- Changes to
Array.prototype[@@iterator]
. - Changes to
%ArrayIteratorPrototype%
.
This patch adds a separate ArrayIteratorPrototypeFuse
that covers just the second
case, and also changes OptimizeGetIteratorFuse
to be dependent on this fuse.
Later patches will use this new fuse to replace ForOfPIC::Chain::tryOptimizeArrayIteratorNext
.
Assignee | ||
Comment 6•3 months ago
|
||
Assignee | ||
Comment 7•3 months ago
|
||
Assignee | ||
Comment 8•3 months ago
|
||
Assignee | ||
Comment 9•3 months ago
|
||
This changes the CacheIR code to match the VM code changes from the previous patches.
Telemetry shows that the OptimizeGetIterator
fuse is popped on less than 0.05% of
websites. With the first two patches in this stack this might drop even more.
The ArrayIteratorPrototype
fuse is a subset of the OptimizeGetIterator
fuse
so worst-case its numbers should be similar.
Assignee | ||
Comment 10•3 months ago
|
||
This micro-benchmark improves from 52 ms to 45 ms (best of 10 runs, with --spectre-mitigations=off
):
function f() {
var arr = [1];
var t = new Date;
for (var i = 0; i < 1_000_000; i++) {
var res = new Set(arr);
}
print(new Date - t);
return res;
}
f();
With new Int8Array(arr)
it improves from 54 ms to 49 ms.
Checking the fuse is faster and simpler than the ForOfPIC
code.
Updated•3 months ago
|
Updated•3 months ago
|
Assignee | ||
Comment 11•3 months ago
|
||
This way we have PropertyFlagsChange
and PropertyValueChange
.
Assignee | ||
Comment 12•3 months ago
|
||
The only reason for this to be fallible is the Watchtower testing code, but if we
recover from failure there we can simplify some of the callers. In particular in
NativeObject.cpp this moves the watchPropertyValueChange
calls closer to the
setSlot
calls.
Updated•3 months ago
|
Updated•3 months ago
|
Updated•3 months ago
|
Updated•3 months ago
|
Updated•3 months ago
|
Updated•3 months ago
|
Updated•3 months ago
|
Assignee | ||
Updated•3 months ago
|
Comment 13•3 months ago
|
||
Comment 14•3 months ago
|
||
bugherder |
Assignee | ||
Updated•3 months ago
|
Comment 15•3 months ago
|
||
Comment 16•3 months ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/c617c71a16ae
https://hg.mozilla.org/mozilla-central/rev/ffc35ef730e4
https://hg.mozilla.org/mozilla-central/rev/23cb8e597ba8
https://hg.mozilla.org/mozilla-central/rev/4c817911289e
https://hg.mozilla.org/mozilla-central/rev/f5cf04c3b582
https://hg.mozilla.org/mozilla-central/rev/2a0b3de2486f
Comment 17•3 months ago
•
|
||
(In reply to Pulsebot from comment #15)
Pushed by jdemooij@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c617c71a16ae
part 6 - Fix bug with cross-realmarguments[Symbol.iterator]
. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/ffc35ef730e4
part 7 - Add separate OptimizeArrayIteratorPrototypeFuse. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/23cb8e597ba8
part 8 - Replace uses of ForOfPIC with fuse checks. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/4c817911289e
part 9 - Remove now unused ForOfPIC and PIC code. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/f5cf04c3b582
part 10 - Make some functions infallible. r=mgaudet
https://hg.mozilla.org/integration/autoland/rev/2a0b3de2486f
part 11 - Rely on fuses in CacheIR code. r=mgaudet
This lead to a 512 byte increase in BAse contetn JS opt fission on MacOS and Linux.
Description
•